package tools.hmmer;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;

public class test {

	public static void main(String[] arg)throws Exception{
//		String infile="/local/membrane_protein/xhaard/hmm/hGPCRs_gt7_helices_phobius_domains.hmm";
		String infile="/local/membrane_protein/hmm/pfam_IN_All";
		BufferedWriter out=new BufferedWriter(new FileWriter("/local/membrane_protein/hmm/pfam_IN_All_topDomains"));
		hmmerParser in=new hmmerParser(new BufferedReader(new FileReader(infile)));
		int antal=1,nrOfDomains=0;
		if(in.hasMore()){
			for(;in.hasMore();antal++){
				hmmerAlignment tmp=in.nextHit();
//				System.out.println(tmp.qname);
				out.write(tmp.qname+"\n");
				hmmerModelAlignment[] top=tmp.getTopDomainsByScore();
				for(int i=0;i<top.length;i++)
					out.write("\t"+top[i].hmmname+"\n");
				nrOfDomains+=top.length;
			}
		}
		out.close();
		System.out.println("Average nr of Domains: "+((double)nrOfDomains/antal));
		System.out.println("Done!");
		System.out.flush();
	}
}
